From 5b341e8e6e2175917cc4d7c0f3fc43304cf51b0c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 12 Mar 2014 00:15:02 -0400 Subject: [PATCH] csd: Fix invisible border/shadow confusion We did not set an input shape on the window, so the region outside the invisible border where we draw the outer edges of the shadow were still part of the window, as far as clicks and cursors were concerned. Fix this by setting an input shape that makes all clicks outside of the resize borders go through to the underlying window. https://bugzilla.gnome.org/show_bug.cgi?id=726125 --- gtk/gtkwindow.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 56955e4120..59d2a037cd 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -6512,6 +6512,16 @@ max_borders (GtkBorder *one, one->left = MAX (one->left, two->left); } +static void +subtract_borders (GtkBorder *one, + GtkBorder *two) +{ + one->top -= two->top; + one->right -= two->right; + one->bottom -= two->bottom; + one->left -= two->left; +} + static void add_window_frame_style_class (GtkStyleContext *context) { @@ -6834,6 +6844,19 @@ update_border_windows (GtkWindow *window) gdk_window_hide (priv->border_window[GDK_WINDOW_EDGE_WEST]); gdk_window_hide (priv->border_window[GDK_WINDOW_EDGE_EAST]); } + + /* we also update the input shape, which makes it so that clicks + * outside the border windows go through + */ + + subtract_borders (&window_border, &border); + rect.x = window_border.left; + rect.y = window_border.top; + rect.width = gtk_widget_get_allocated_width (widget) - window_border.left - window_border.right; + rect.height = gtk_widget_get_allocated_height (widget) - window_border.top - window_border.bottom; + region = cairo_region_create_rectangle (&rect); + gtk_widget_input_shape_combine_region (widget, region); + cairo_region_destroy (region); } static void -- 2.30.2